/**
 *
 * Message.java
 * This class represents a message which can be send to instances of Person.
 *
 * @author Felix Schuller
 */

package Runde2;


import java.util.GregorianCalendar;

public class Message {
	private String sender;
	private String message;
	private GregorianCalendar date;
	private boolean read;
	
	/**
	 * Creates a new message
	 * 
	 * @param sender - sender of the message
	 * @param date - time of message transmission
	 * @param message - text-based content of the message
	 */
	public Message(String sender, GregorianCalendar date, String message){
		this.sender = sender;
		this.message = message;
		this.date = date;
		this.read = false;
	}
	
	/**
	 * Returns a readable form of message
	 * 
	 * @return - readable message
	 */
	public String toString(){
		read = true;
		return date.getTime() + " - from " + sender + "\n\t" + message;
	}
	
	/**
	 * Returns true or false whether message was already read once, or not
	 * 
	 * @return -  true or false whether message was already read once, or not
	 */
	public boolean wasRead(){
		return read;
	}
	
}
